<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //         ### 练习题8：

        // 给一个数字数组，该数组中有很多数字0，将不为0的数据存入到一个新的数组中
        let a = [1, 2, 0, 3, 5, 0, 4, 6, 7, 0, 8, 0, 9]
        let b = []
        for (i = 0; i < a.length; i++) {
            if (a[i] !== 0) {
                b.push(a[i])
            }
        }
        console.log(b);
    </script>
</body>

</html>